
const path = require('path')
const webpack = require('webpack');
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');

// 输出目录
const outPath = path.resolve(__dirname, './', 'build')

/**
 * 打包源码
 */
module.exports = {
  mode: 'development',//'development',
  // 入口
  entry:"./Math3d/index.js",
  // 出口
  output: {
      filename: 'Math3d.js',
      publicPath: "./",
      path: outPath,
  },
  optimization: {
    // 压缩混淆
    minimize: false,
  },
  module: {
    rules: [
      // es6 转 es5
      {
        test: /\.js$/,
        use: 'babel-loader',
        exclude: /node_modules/
      },
    ]
  },
  plugins: [
    new CleanWebpackPlugin({
      cleanOnceBeforeBuildPatterns: ["build"]
    }),
    new webpack.DefinePlugin({
      'process.env': {
          'NODE_ENV': JSON.stringify('development')
      }
    }),
  ],
  externals: {
  }
}
